package com.hiq.gene.engine;

import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;

public class Configuration {
    private final static String FILE_PATH = "higen.properties";
    private Properties properties;

    private Configuration(Properties properties) {
        this.properties = properties;
    }

    public static Configuration getInstance() {
        Properties properties = new Properties();
        try {
            properties.load(new FileReader(FILE_PATH));
        } catch (IOException e) {
            throw new RuntimeException("Can't load the properties file: " + FILE_PATH);
        }
        return new Configuration(properties);
    }

    public static Configuration getInstance(String filePath) {
        Properties properties = new Properties();
        try {
            properties.load(new FileReader(filePath));
        } catch (IOException e) {
            throw new RuntimeException("Can't load the properties file: " + filePath);
        }
        return new Configuration(properties);
    }

    public String getProperty(String value) {
        return properties.getProperty(value);
    }
}
